package biz.innovasoft.nodb.transaction;

import java.util.Date;

import org.prevayler.TransactionWithQuery;

import biz.innovasoft.nodb.impl.GenericRepository;

public class UpdateTransaction implements TransactionWithQuery {

	private static final long serialVersionUID = 1L;
	
	private final Long oid;
	private final Object data;
	private final int indexType;
	
	public UpdateTransaction (Long oid, Object data, int indexType) {
		this.oid = oid;
		this.data = data;
		this.indexType = indexType;
	}
	
	@Override
	public Object executeAndQuery(Object prevalentSystem, Date time) throws Exception {
		GenericRepository repository = (GenericRepository)prevalentSystem;
		return repository.update(oid, data, indexType);
	}

}
